import { v4 } from 'uuid';


const Wog = class {
	constructor(W) {
		this.W = W;
		this.uuid = v4();
	}

	static ready = 0;
	static wait = 1;
	static done = 2;
	static error = 3;
	static warn = 4;

	get ready() { return Wog.ready; }
	get wait() { return Wog.wait; }
	get done() { return Wog.done; }
	get error() { return Wog.error; }
	get warn() { return Wog.warn; }

	add(stat, title, text, sub) {
		if(this.W) {
			this.W.cast('addLog', this.uuid, { stat, title, text, sub });
		}
	}
	set(...datas) {
		if(this.W) {
			this.W.cast('setLog', this.uuid, ...datas);
		}
	}
	addSub(sub, stat, title, text) {
		if(this.W) {
			this.W.cast('addLogSub', this.uuid, sub, { stat, title, text });
		}
	}
};


export default Wog;
